package db.pojo;

import java.util.*;
import java.text.SimpleDateFormat;
import db.ext.EaeventExt;
@SuppressWarnings("unchecked")
/**
 * eaevent
 */
public class Eaevent {
	/**
	 * EVENTID
	 */
	public String eVENTID;
	/**
	 * USERID
	 */
	public String uSERID;
	/**
	 * ACCOUNT
	 */
	public String aCCOUNT;
	/**
	 * USERNAME
	 */
	public String uSERNAME;
	/**
	 * DESCRIPTION
	 */
	public String dESCRIPTION;
	/**
	 * ACTIVETIME
	 */
	public long aCTIVETIME;
	/**
	 * REQUESTPATH
	 */
	public String rEQUESTPATH;
	/**
	 * METHODNAME
	 */
	public String mETHODNAME;
	/**
	 * COSTTIME
	 */
	public int cOSTTIME;
	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static EaeventExt DB = new EaeventExt(); 
	
	public Eaevent() {
		super();
	}
	
	public Eaevent(String eVENTID, String uSERID, String aCCOUNT, String uSERNAME, String dESCRIPTION, long aCTIVETIME, String rEQUESTPATH, String mETHODNAME, int cOSTTIME) {
		super();
		this.eVENTID = eVENTID; 
		this.uSERID = uSERID; 
		this.aCCOUNT = aCCOUNT; 
		this.uSERNAME = uSERNAME; 
		this.dESCRIPTION = dESCRIPTION; 
		this.aCTIVETIME = aCTIVETIME; 
		this.rEQUESTPATH = rEQUESTPATH; 
		this.mETHODNAME = mETHODNAME; 
		this.cOSTTIME = cOSTTIME; 
	}
	
	public String getEVENTID() {
		return eVENTID;
	}

	public void setEVENTID(String eVENTID) {
		this.eVENTID = eVENTID;
	} 
	
	public String getUSERID() {
		return uSERID;
	}

	public void setUSERID(String uSERID) {
		this.uSERID = uSERID;
	} 
	
	public String getACCOUNT() {
		return aCCOUNT;
	}

	public void setACCOUNT(String aCCOUNT) {
		this.aCCOUNT = aCCOUNT;
	} 
	
	public String getUSERNAME() {
		return uSERNAME;
	}

	public void setUSERNAME(String uSERNAME) {
		this.uSERNAME = uSERNAME;
	} 
	
	public String getDESCRIPTION() {
		return dESCRIPTION;
	}

	public void setDESCRIPTION(String dESCRIPTION) {
		this.dESCRIPTION = dESCRIPTION;
	} 
	
	public long getACTIVETIME() {
		return aCTIVETIME;
	}

	public void setACTIVETIME(long aCTIVETIME) {
		this.aCTIVETIME = aCTIVETIME;
	} 
	
	public void changeACTIVETIMEWith(long aCTIVETIME){
		this.aCTIVETIME += aCTIVETIME;
	}
	
	public void changeACTIVETIMEWithMin(long aCTIVETIME,long min){
		this.aCTIVETIME += aCTIVETIME;
		this.aCTIVETIME = this.aCTIVETIME < min ? min : this.aCTIVETIME;
	}
	
	public void changeACTIVETIMEWithMax(long aCTIVETIME,long max){
		this.aCTIVETIME += aCTIVETIME;
		this.aCTIVETIME = this.aCTIVETIME > max ? max : this.aCTIVETIME;
	}
	
	public void changeACTIVETIMEWithMaxMin(long aCTIVETIME,long max,long min){
		this.aCTIVETIME += aCTIVETIME;
		this.aCTIVETIME = this.aCTIVETIME < min ? min : this.aCTIVETIME;
		this.aCTIVETIME = this.aCTIVETIME > max ? max : this.aCTIVETIME;
	}	
	public String getREQUESTPATH() {
		return rEQUESTPATH;
	}

	public void setREQUESTPATH(String rEQUESTPATH) {
		this.rEQUESTPATH = rEQUESTPATH;
	} 
	
	public String getMETHODNAME() {
		return mETHODNAME;
	}

	public void setMETHODNAME(String mETHODNAME) {
		this.mETHODNAME = mETHODNAME;
	} 
	
	public int getCOSTTIME() {
		return cOSTTIME;
	}

	public void setCOSTTIME(int cOSTTIME) {
		this.cOSTTIME = cOSTTIME;
	} 
	
	public void changeCOSTTIMEWith(int cOSTTIME){
		this.cOSTTIME += cOSTTIME;
	}
	
	public void changeCOSTTIMEWithMin(int cOSTTIME,int min){
		this.cOSTTIME += cOSTTIME;
		this.cOSTTIME = this.cOSTTIME < min ? min : this.cOSTTIME;
	}
	
	public void changeCOSTTIMEWithMax(int cOSTTIME,int max){
		this.cOSTTIME += cOSTTIME;
		this.cOSTTIME = this.cOSTTIME > max ? max : this.cOSTTIME;
	}
	
	public void changeCOSTTIMEWithMaxMin(int cOSTTIME,int max,int min){
		this.cOSTTIME += cOSTTIME;
		this.cOSTTIME = this.cOSTTIME < min ? min : this.cOSTTIME;
		this.cOSTTIME = this.cOSTTIME > max ? max : this.cOSTTIME;
	}	
	
	public Map eaeventToMap() {
		Map map = new HashMap();
		try {
			map.put("eVENTID",this.eVENTID);
			map.put("uSERID",this.uSERID);
			map.put("aCCOUNT",this.aCCOUNT);
			map.put("uSERNAME",this.uSERNAME);
			map.put("dESCRIPTION",this.dESCRIPTION);
			map.put("aCTIVETIME",this.aCTIVETIME);
			map.put("rEQUESTPATH",this.rEQUESTPATH);
			map.put("mETHODNAME",this.mETHODNAME);
			map.put("cOSTTIME",this.cOSTTIME);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}

	public Eaevent mapToEaevent(Map map){
		try {
			String eVENTID =  map.get("eVENTID").toString();
			String uSERID =  map.get("uSERID").toString();
			String aCCOUNT =  map.get("aCCOUNT").toString();
			String uSERNAME =  map.get("uSERNAME").toString();
			String dESCRIPTION =  map.get("dESCRIPTION").toString();
			long aCTIVETIME = Long.parseLong( map.get("aCTIVETIME").toString());
			String rEQUESTPATH =  map.get("rEQUESTPATH").toString();
			String mETHODNAME =  map.get("mETHODNAME").toString();
			int cOSTTIME = Integer.parseInt( map.get("cOSTTIME").toString());
			Eaevent eaevent = new Eaevent(eVENTID, uSERID, aCCOUNT, uSERNAME, dESCRIPTION, aCTIVETIME, rEQUESTPATH, mETHODNAME, cOSTTIME);
			return eaevent;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	} 
	
	public String toString(){
		return eaeventToMap().toString();
	}
	
	//方便数据操作	
	public Eaevent insert(){
		return DB.insert(this);
	}
	public Eaevent update(){
		return DB.update(this);
	}
	
	public int delete(){
		return DB.delete(this);
	}
	
}
